package com.demo.Controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @Author zqc
 * @Date 2021/01/25 14:35
 * @Description OAuth - Github 第三方登录
 */
@Api(tags = "OAuth第三方登录")
@RestController
@RequestMapping("/oauth")
public class OAuthGithubController {

    /**
     * Principal有Spring自动注入，表示当前登录的用户
     */
    @ApiOperation("GitHub")
    @GetMapping("/github")
    public String Hello(Principal principal){
        return "hello,"+principal.getName();
    }

}
